#!/usr/bin/env python3
"""
启动 MCP Server 的脚本
"""

import subprocess
import sys
import os

def main():
    """启动服务器"""
    print("启动仲裁案件管理和加解密 MCP Server...")
    
    # 确保在正确的目录中
    script_dir = os.path.dirname(os.path.abspath(__file__))
    os.chdir(script_dir)
    
    # 检查依赖
    try:
        import mcp
        print("✓ MCP 依赖已安装")
    except ImportError:
        print("✗ 缺少 MCP 依赖，请运行: pip install mcp")
        return 1
    
    try:
        import cryptography
        print("✓ cryptography 依赖已安装")
    except ImportError:
        print("✗ 缺少 cryptography 依赖，请运行: pip install cryptography")
        return 1
    
    # 启动服务器
    try:
        subprocess.run([sys.executable, "mcp_server.py"], check=True)
    except KeyboardInterrupt:
        print("\n服务器已停止")
        return 0
    except Exception as e:
        print(f"服务器启动失败: {e}")
        return 1

if __name__ == "__main__":
    exit(main())
